<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" href="/Public/Admin/css/pintuer.css">
    <link rel="stylesheet" href="/Public/Admin/css/admin.css">
    <script src="/Public/Admin/js/jquery.js"></script>
    <script src="/Public/Admin/js/pintuer.js"></script>
</head>
<body>



<div class="panel admin-panel">
    <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>增加内容</strong></div>
    <div class="body-content">
        <form name="main_form" class="form-x" id="myform" method="POST" action="/Admin/vip/add.html" enctype="multipart/form-data">
            <input type="hidden" name="userid" value="admin">
            <div class="form-group">
                <div class="label">
                    <label>会员时长：</label>
                </div>
                <div class="field">
                    <input type="text" class="input w50" value="" placeholder="一个月" name="name"
                           />
                    <div class="tips"></div>
                </div>
            </div>
            <div class="form-group" id="sj">
                <div class="label">
                    <label>会员价格：</label>
                </div>
                <div class="field">
                    <input type="text" id="money" placeholder="10"  class="input w35" value="" name="money"/>
                    <label>元</label>
                    <div class="tips"></div>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label></label>
                </div>
                <div class="field">
                    <input id="submit" type="button" value="提交" class="button bg-blue">
                    <input type="reset" value="重置" class="button bg-red">
                    <input type="button" value="取消" onclick="javascript :history.back(-1)" class="button bg-blue">
                </div>
            </div>
        </form>
    </div>
</div>
<script src="/Public/layui/layui.all.js"></script>
<script>
    $("#submit").click(function () {
        var data = $("#myform").serialize();
        console.log(data);
        if ($("input[name='name']").val() == '' || $("input[name='name']").val() == undefined) {
            alert('会员时长不能为空');
            return false;
        }
        if ($("input[name='money']").val() == '' || $("input[name='money']").val() == undefined) {
            alert('会员价格不能为空');
            return false;
        }
        $.post("<?php echo U('add')?>", data, function (res) {
            alert(res.info);
            location.href = res.url;
        })
    })

</script>


</body>
</html>